package com.hazy.animalface.utils;

import android.support.v7.app.AlertDialog;
import android.view.LayoutInflater;
import android.view.View;
import android.widget.TextView;

import com.hazy.animalface.BaseActivity;
import com.hazy.animalface.R;

/**
 * Created by Hazy on 2017/9/9.
 * <p>
 * 工具包
 */

public class AnimalUtils {

    private static AlertDialog progressDialog;

    /**
     * 显示加载框
     *
     * @param activity
     */
    public static void showWaitDialog(BaseActivity activity) {
        View dialogView = LayoutInflater.from(activity).inflate(R.layout.dialog_upload_progress, null);
        TextView mProgressTextView = (TextView) dialogView.findViewById(R.id.uploading_count_tv);
        mProgressTextView.setText(activity.getString(R.string.loading));
        progressDialog = new AlertDialog.Builder(activity).setView(dialogView).create();
        progressDialog.show();
        progressDialog.setCanceledOnTouchOutside(false);
    }

    /**
     * 关闭加载框
     */
    public static void dismissWaitDialog() {
        if (progressDialog != null) {
            progressDialog.dismiss();
        }
    }

}
